﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace OnlineStore
{
    public class ProductController : Controller
    {
        private readonly IProductService productService;

        public ProductController() : this(new ProductService()) { }

        public ProductController(IProductService service) {
            productService = service;
        }

        //
        // GET: /Product/

        public ActionResult Index()
        {
            var products = productService.GetAll().ToList();
            return View(products);
        }

    }
}
